package com.hgdp.medicalexamination.controller;

import com.baomidou.mybatisplus.extension.api.R;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hgdp.medicalexamination.entity.DicMarryJob;
import com.hgdp.medicalexamination.mapper.DicMarryJobMapper;
import com.hgdp.medicalexamination.service.DicMarryJobService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
/**
 * @param 
 * @author hgdp
 * @date 2020-07-30 10:36:49
 */
@RestController
@AllArgsConstructor
@Api(value = "操作接口")
@RequestMapping("/dicmarryjob")
public class DicMarryJobController {

    private DicMarryJobService dicMarryJobService;
    private DicMarryJobMapper dicMarryJob;

    /**
   	  * 列表
     */
    @ApiOperation(value = "分页查询", notes = "分页查询dicMarryJob ")
  	@GetMapping("/pagelist")
    public R list(Page page, DicMarryJob dicMarryJob){
        return R.ok(dicMarryJobService.queryPage(page,dicMarryJob));
    }

    /**
     * 列表
     */
    @ApiOperation(value = "查询", notes = "查询dicMarryJob ")
    @GetMapping("/list")
    public R list(){
        return R.ok(dicMarryJob.selectList(null));
    }

    /**
     * 信息
     */
    @ApiOperation(value = "通过id查询", notes = "通过id查询dicMarryJob ")   
    @GetMapping("/info/{code}")
    public R info(@PathVariable("code") String code){
        return R.ok(dicMarryJobService.getById(code));
    }

    /**
     * 保存
     */
     @ApiOperation(value = "保存", notes = "保存") 
  	@PostMapping("/save")
    public R save(@RequestBody DicMarryJob dicMarryJob){
        return R.ok(dicMarryJobService.save(dicMarryJob));
    }


   /**
    * 修改
    * @param dicMarryJob 
    * @return R
    */
    @ApiOperation(value = "修改", notes = "修改")    
    @PutMapping("/update")
    public R update(@RequestBody DicMarryJob dicMarryJob){
        return R.ok(dicMarryJobService.updateById(dicMarryJob));
    }

    /**
     * 删除
     */
    @ApiOperation(value = "通过id删除", notes = "通过id删除")    
    @DeleteMapping("/delete")
    public R delete(@RequestBody String[] codes){
        return R.ok(dicMarryJobService.removeByIds(Arrays.asList(codes)));
    }
}